import { Inject, Controller, Post, Provide } from '@midwayjs/decorator'

import { BaseController } from './base'
import { UploadService } from '../service/upload'

@Provide()
@Controller('/api/tz')
export class TzController extends BaseController {

  @Inject()
  uploadService: UploadService

  @Post('/sign')
  async signResolver() {
    const stream = await this.ctx.getFileStream()
    const returning = await this.uploadService.upload(stream)

    return this.ok(returning)
  }
}
